﻿using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace MyAppProjectControl.BaseViewModels
{
    public class IDalogViewModelBase : BindableBase, IDialogAware
    {
        #region ViewProperty

        public double WinWidth
        {
            get
            {
                return Application.Current.MainWindow.ActualWidth;
            }
        }

        public double WinHeigth
        {
            get
            {

                return Application.Current.MainWindow.ActualHeight;
            }
        }
        public List<int> Limits { get; set; } = new List<int>()
        {
            10,15,20
        };

        #endregion

        public string Title => "";

        public event Action<IDialogResult> RequestClose;

        private bool IsCanClose { set; get; }
        public bool CanCloseDialog()
        {
            return IsCanClose;
        }

        public virtual void OnDialogClosed()
        {

        }

        public virtual void OnDialogOpened(IDialogParameters parameters)
        {

        }

        protected void HandClose(DialogResult _DialogResult)
        {
            IsCanClose = _DialogResult.Result == ButtonResult.Retry ? false : true;
            RequestClose?.Invoke(_DialogResult);
        }


    }
}
